package com.xianzhiOA.websocket;

import javax.servlet.http.HttpSession;
import javax.websocket.HandshakeResponse;
import javax.websocket.server.HandshakeRequest;
import javax.websocket.server.ServerEndpointConfig;

/**
 * Created by Administrator on 2017/5/9.
 */
public class HttpSessionConfigurator extends ServerEndpointConfig.Configurator {

    @Override
    public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
        HttpSession httpSession = (HttpSession) request.getHttpSession();
        /*System.out.println(httpSession);
        System.out.println(sec.getUserProperties());*/
        sec.getUserProperties().put(HttpSession.class.getName(), httpSession);
    }
}